Fix PHPUnit deprecations, notices and PHPStan errors#182
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses technical debt by fixing PHPUnit deprecations, PHPStan type errors, and CakePHP 5.3.0 compatibility issues in the test suite and source code.
Changes:
- Modernized PHPUnit mock creation using
createStub()instead of deprecatedgetMockBuilder()chain - Added backwards-compatible
eventListToArray()helper to handle CakePHP 5.3.0+ EventList Traversable implementation - Fixed PHPDoc issues including typos and invalid constructor return type annotations
- Enhanced type safety with method parameter type hints, json_encode casts, and type narrowing annotations
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/TestCase/QueueManagerTest.php | Removed redundant null parameter from setConfig test to properly test exception handling |
| tests/TestCase/Queue/ProcessorTest.php | Added EventList compatibility helper, fixed typo, added type hints, casts, and improved assertions |
| tests/TestCase/PluginTest.php | Replaced deprecated getMockBuilder with createStub for Application mock |
| src/Consumption/RemoveUniqueJobIdFromCacheExtension.php | Removed invalid @return void from constructor PHPDoc |
| src/Consumption/LimitConsumedMessagesExtension.php | Removed invalid @return void from constructor PHPDoc |
| src/Consumption/LimitAttemptsExtension.php | Removed invalid @return void from constructor PHPDoc |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes deprecation warnings, PHPUnit notices, and PHPStan errors in the test suite.
Changes
getMockBuilder()->...->getMock()withcreateStub()in PluginTest.phpeventListToArray()helper to fix CakePHP 5.3.0EventListarray access deprecation$lastProcessMessage$dispacthedEvent→$dispatchedEventtestProcess()method parametersjson_encode()to(string)to satisfy PHPStan@varannotations forEventManagerandArrayLogtype narrowingassertNotEmpty()withassertInstanceOf()for typed static property